package com.jiyun.controller;

import com.jiyun.model.chengyuan.FamilyDto;
import com.jiyun.result.Result;
import com.jiyun.service.chengyuanService;
import com.jiyun.vo.chengyuan.ChengyuanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("chengyuan")
@Api(tags = "chengyuan管理模块")
public class chengyuanController {
    @Autowired
    private chengyuanService chengyuanService;
    @ApiOperation(value = "查询居民关系")
    @RequestMapping("findGuanxi")
    public List<ChengyuanVO> fandGuanxi(Integer id){
        return chengyuanService.findGuanxi(id);
    }

    @ApiOperation("添加家庭关联成员")
    @PostMapping("/addFamilyMember")
    public Result addFamilyMember(@RequestBody FamilyDto familyDto){
        chengyuanService.addFamilyMember(familyDto);
        return Result.ok();
    }
}
